package ru.ssau.university.web.helper;

import java.util.ArrayList;
import java.util.List;

import ru.ssau.university.ejb.api.UniversityServiceLocal;
import ru.ssau.university.persistence.entity.Progress;
import ru.ssau.university.persistence.entity.Student;

public class ProgressRow {
	private Student student;
	private List<ProgressWrapper> progress;
	
	public ProgressRow(Student student, Long planItemId, UniversityServiceLocal universityService) {
		this.student = student;
		this.progress = new ArrayList<ProgressWrapper>();
		for (int numb = 0; numb < 16; numb++) {
			Progress p = universityService.getProgress(student.getId(), planItemId, numb);
			if (p == null) {
				p = new Progress();
				p.setMark("-");
				p.setNumb(numb);
				p.setStudent(student);
			} 
			progress.add(new ProgressWrapper(p));
		}
	}

	public Student getStudent() {
		return student;
	}

	public void setStudent(Student student) {
		this.student = student;
	}

	public List<ProgressWrapper> getProgress() {
		return progress;
	}

	public void setProgress(List<ProgressWrapper> progress) {
		this.progress = progress;
	}
}
